import 'package:bruno/bruno.dart';
import 'package:common/common.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../auth/login/widget/content_text_field_widget.dart';
import 'authentication_page.dart';
import 'withdrawal_record_page.dart';

class WithdrawalPage extends StatefulWidget {
  const WithdrawalPage({super.key});

  @override
  State<WithdrawalPage> createState() => _WithdrawalPageState();
}

class _WithdrawalPageState extends State<WithdrawalPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      color: const Color(0xFFEEF6F6),
      child: Stack(
        children: [
          Image.asset('assets/app/images/member/withdrawal_bg.png'),
          Scaffold(
            appBar: BrnAppBar(title: '提现', backgroundColor: Colors.transparent),
            backgroundColor: Colors.transparent,
            body: Container(
              color: Colors.transparent,
              child: ListView(
                children: [
                  _buildPriceInfoWarpper(),
                  _buildPriceControlWarpper(),
                  _buildPriceDescWarpper(),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

  Container _buildPriceInfoWarpper() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 19.w, vertical: 16),
      margin: EdgeInsets.only(top: 20.h, left: 12, right: 12),
      height: 162.h,
      decoration: const BoxDecoration(
          image:
              DecorationImage(image: AssetImage('assets/app/images/member/withdrawal_card_bg.png'), fit: BoxFit.fill)),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Column(
            children: [
              Text('可提现金额', style: TextStyle(fontSize: 19.sp, color: Colors.black)),
              const SizedBox(height: 10),
              Text('609', style: TextStyle(fontSize: 32.sp, color: Colors.black, fontWeight: FontWeight.bold)),
            ],
          ),
          const SizedBox(height: 15),
          Row(
            children: [
              Container(
                height: 32.h,
                decoration: BoxDecoration(color: const Color(0xFFD7F7F6), borderRadius: BorderRadius.circular(16.r)),
                padding: const EdgeInsets.symmetric(horizontal: 12),
                child: Center(
                  child: Text('实名信息',
                      style: TextStyle(color: const Color(0xFF25D4D0), fontSize: 12.sp, fontWeight: FontWeight.w600)),
                ),
              ).onTap(() {
                Get.to(const AuthenticationPage());
              }),
              Container(
                margin: const EdgeInsets.only(left: 20),
                height: 32.h,
                decoration: BoxDecoration(color: const Color(0xFF25D4D0), borderRadius: BorderRadius.circular(16.r)),
                padding: const EdgeInsets.symmetric(horizontal: 12),
                child: Center(
                  child:
                      Text('提现记录', style: TextStyle(color: Colors.white, fontSize: 12.sp, fontWeight: FontWeight.w600)),
                ),
              ).onTap(() {
                Get.to(const WithdrawalRecordPage());
              }),
            ],
          ),
        ],
      ),
    );
  }

  Container _buildPriceControlWarpper() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 19.w, vertical: 16),
      margin: EdgeInsets.only(top: 12.h, left: 12, right: 12),
      height: 276.h,
      decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(16.r)),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text('可提现金额', style: TextStyle(fontSize: 19.sp, color: Colors.black)),
              const SizedBox(height: 10),
              Row(
                children: [
                  Text('¥', style: TextStyle(fontSize: 40.sp, color: Colors.black, fontWeight: FontWeight.bold)),
                  Expanded(
                    child: ContentTextFieldWidget(
                      hintText: '请输入提现金额~',
                      text: '',
                      maxLength: 18,
                      backgroundColor: Colors.transparent,
                      border: Border.all(color: Colors.transparent, width: 0),
                      top: 0,
                      number: false,
                      onChanged: (value) {},
                      onSubmit: (value) {},
                    ),
                  ),
                ],
              ),
            ],
          ),
          Container(color: const Color(0xffEEEEEE), height: 0.5),
          const SizedBox(height: 15),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                height: 32.h,
                padding: const EdgeInsets.symmetric(horizontal: 12),
                child: Center(child: Text('提现至', style: TextStyle(color: const Color(0xFF000000), fontSize: 14.sp))),
              ),
              Container(
                margin: const EdgeInsets.only(left: 20),
                height: 32.h,
                padding: const EdgeInsets.symmetric(horizontal: 12),
                child: Center(
                    child: Row(
                  children: [
                    Text('支付宝账户  ', style: TextStyle(color: const Color(0xFF000000), fontSize: 14.sp)),
                    Image.asset('assets/images/mine/mine_arrow.png', width: 6.w, color: const Color(0xFF999999)),
                  ],
                )),
              ),
            ],
          ),
          const SizedBox(height: 10),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                height: 40.h,
                padding: const EdgeInsets.symmetric(horizontal: 12),
                child: Center(
                  child: Text('暂无提现账户', style: TextStyle(color: const Color(0xFF999999), fontSize: 14.sp)),
                ),
              ),
              Container(
                margin: const EdgeInsets.only(left: 20),
                height: 32.h,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(16.r),
                    border: Border.all(color: const Color(0xFF25D4D0), width: 1)),
                padding: const EdgeInsets.symmetric(horizontal: 12),
                child: Center(
                  child: Text('添加', style: TextStyle(color: const Color(0xFF25D4D0), fontSize: 13.sp)),
                ),
              ),
            ],
          ),
          Container(
            margin: const EdgeInsets.only(top: 10),
            height: 45.h,
            decoration: BoxDecoration(color: const Color(0xFF25D4D0), borderRadius: BorderRadius.circular(22.5.r)),
            padding: const EdgeInsets.symmetric(horizontal: 12),
            child: Center(
              child: Text('确认提现', style: TextStyle(color: Colors.white, fontSize: 12.sp, fontWeight: FontWeight.w600)),
            ),
          ),
        ],
      ),
    );
  }

  Container _buildPriceDescWarpper() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 19.w, vertical: 16),
      margin: EdgeInsets.only(top: 12.h, left: 12, right: 12),
      // height: 276.h,
      decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(16.r)),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text('提现需要什么条件？', style: TextStyle(fontSize: 16.sp, color: Colors.black, fontWeight: FontWeight.w600)),
              const SizedBox(height: 10),
              Text("""提现需要什么条件？
1、单次提现金额最少50.00，最多1000.00。
2、需要进行实名认证后才可提现，实名认证要求18周岁以上。
3、需要填写支付宝账号作为提现账户。""", style: TextStyle(fontSize: 13.sp, color: const Color(0xFF999999))),
              const SizedBox(height: 10),
              Text('如有其他疑问请及时联系客服。',
                  style: TextStyle(fontSize: 16.sp, color: const Color(0xFF25D4D0), fontWeight: FontWeight.w600)),
              const SizedBox(height: 10),
            ],
          ),
        ],
      ),
    );
  }
}
